#ifndef __TP_ITE7259H_
#define __TP_ITE7259H_
	
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include "nrf_delay.h"
#include "nrf_log.h"
#include "nrf_drv_gpiote.h"

#define MAX_FINGER_NUM   				 					1
#define DEVICE_ADDRESS   				 					0x8C>>1
#define COMMAND_BUFFER_INDEX   						0x20
#define QUERY_BUFFER_INDEX				 				0x80
#define COMMAND_RESPONSE_BUFFER_INDEX    	0xA0
#define POINT_BUFFER_INDEX   		     			0xE0

#define QUERY_SUCCESS        		     			0x00
#define QUERY_BUSY            			 			0x01
#define QUERY_ERROR            					 	0x02
#define QUERY_POINT					     					0x80

#define INT_ENABLE						 						1
#define INT_DISABLE 		 			 						0
#define INT_MODE_LOW_LEVEL   		     			0x00
#define INT_MODE_LOW_LWVEL    		     		0x01
#define INT_MODE_FALLING      			 			0x10
#define INT_MODE_RISING      		     			0x11

//
#define THRESHOLD_PARA			   	  				0
#define ACTIVE_MODE												0
#define SLEEP_MODE												1
#define POWEROFF_MODE											2


void tp7259_init(void);
bool ReadCommandResponseBuffer(uint8_t *pdata, uint8_t len);
bool ReadPointBuffer(uint8_t *pdata);
bool WriteCommandBuffer(uint8_t *pdata, uint8_t len);
bool IdentifyCapSensor(void);
bool GetFirmwareInformation(uint8_t *pucData);
bool Get2DResolutions(uint16_t *pwXResolution, uint16_t *pwYResolution, uint8_t *pucStep);
bool SetInterruptNotification(uint8_t ucStatus, uint8_t ucType);
bool MassProductionCalibration(void);
void CaptouchHWInitial(void);
int CaptouchInterruptHandle(void);
bool CaptouchPollingHandle(void);
int CaptouchGetSampleValue(uint16_t *pdwSampleX, uint16_t *pdwSampleY, uint16_t *pdwPressure);
int CaptouchGetGesture(void);
int CaptouchSetPara(uint16_t dwMode, uint16_t value);
int CaptouchReset(void);
int CaptouchGetVersion(void);


#endif

